package site.timers.chat.config;

import io.netty.bootstrap.ServerBootstrap;
import jakarta.annotation.PostConstruct;
import org.springframework.context.annotation.Configuration;
import site.timers.chat.util.netty.GroupChatServer;

/**
 * @Classname NettyServerConfig
 * @Description TODO
 * @Version 1.0.0
 * @Date 2025/8/12 16:27
 * @Author twl
 */
@Configuration
public class NettyServerConfig {

    @PostConstruct
    public void run() {
        new Thread(this::serverBootstrap).start();
    }

    public ServerBootstrap serverBootstrap() {
        GroupChatServer groupChatServer = new GroupChatServer(7000);
        try {
            return groupChatServer.run();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
